﻿CREATE TABLE [dbo].[MaintenanceSubPlan] (
    [MaintenancePlanId]      INT            IDENTITY (1, 1) NOT NULL,
    [MaintenancePlan]        NVARCHAR (4000) NULL,
    [SubPlan]                NVARCHAR (4000) NULL,
    [Enabled]                NVARCHAR (4000)  NULL,
    [Frequency]              NVARCHAR (4000)  NULL,
    [Interval]               NVARCHAR (4000)  NULL,
    [Time]                   NVARCHAR (4000)  NULL,
    [Next Run Time]          DATETIME       NULL,
    [PackageSource]          NVARCHAR (MAX) NULL,
    [HasReBuildIndexTask]    BIT            NULL,
    [HasReorganizeIndexTask] BIT            NULL,
    [HasAutoShrinkTask]      BIT            NULL,
    [ServiceId]              INT            NULL,
    [JobId]                  INT            NULL,
    CONSTRAINT [PK__Maintena__0C08BC02276EDEB3] PRIMARY KEY CLUSTERED ([MaintenancePlanId] ASC),
    CONSTRAINT [FK_MaintenanceSubPlan_Service] FOREIGN KEY ([ServiceId]) REFERENCES [dbo].[Service] ([ServiceID]),
    CONSTRAINT [FK_MaintenanceSubPlan_SQLAgentJobDetails] FOREIGN KEY ([JobId]) REFERENCES [dbo].[SQLAgentJobDetails] ([JobID])
);






